//
//  AXHomeZjzdEvaluateCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/29.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXHomeZjzdEvaluateCell.h"
#import "UIImageView+WebCache.h"

@implementation AXHomeZjzdEvaluateCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
       
    }
    return self;
}

- (void)creatView {
    
    /** 评论时间 */
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.textColor = COLOR_DIV;
    self.nameLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.nameLabel];
    
    /** 满意 */
    self.satisfactionLabel = [[UILabel alloc]init];
    self.satisfactionLabel.textColor = COLOR_ORG;
    self.satisfactionLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.satisfactionLabel];
    
    /** 评论者图片 */
    self.commentImageView = [[UIImageView alloc]init];
    self.commentImageView.cornerRadius = 30;
    self.commentImageView.contentMode =UIViewContentModeScaleAspectFill;
    self.commentImageView.clipsToBounds=YES;//
    [self.contentView addSubview:self.commentImageView];
    
    /** 评论内容 */
    self.commentLabel = [[UILabel alloc]init];
    self.commentLabel.textColor = COLOR_DIV;
    self.commentLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.commentLabel];
    
    /** 评论时间 */
    self.commentTimeLabel = [[UILabel alloc]init];
    self.commentTimeLabel.textColor = COLOR_DIV;
    self.commentTimeLabel.font = FONT_FOURTEEN;
    [self.contentView addSubview:self.commentTimeLabel];
    
  
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = COLOR_LINE;
    [self.contentView addSubview:self.lineView];
 
}

- (void)setlayout {
    
    
    
    /** 评论者图片 */
    self.commentImageView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .centerYEqualToView(self.contentView)
    .widthIs(60)
    .heightIs(60);
    
    self.nameLabel.sd_layout
    .leftSpaceToView(self.commentImageView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(100)
    .heightIs(20);
    
    self.satisfactionLabel.sd_layout
    .leftSpaceToView(self.nameLabel, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(100)
    .heightIs(20);
    
    
    
    /** 评论内容 */
    self.commentLabel.sd_layout
    .leftSpaceToView(self.commentImageView, 10)
    .topSpaceToView(self.nameLabel, 10)
    .rightSpaceToView(self.contentView, 10)
    .autoHeightRatio(0)
    .minHeightIs(60);
    
    
    /** 评论时间 */
    self.commentTimeLabel.sd_layout
    .leftSpaceToView(self.commentImageView, 10)
    .topSpaceToView(self.commentLabel, 10)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(20);
    
 
    
    self.lineView.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.commentTimeLabel, 10)
    .rightSpaceToView(self.contentView, 0)
    .heightIs(10);
    
    
    [self setupAutoHeightWithBottomView:self.lineView bottomMargin:20];
    
}

- (void)setModel:(AXHomeZjzdEvaluateModel *)model {
    
    _model = model;
    /** 姓名 */
    _nameLabel.text = _model.fNickName;
    /** 满意度 */
    _satisfactionLabel.text = _model.fSatisfactionCHS;
    /** 图像 */
    [_commentImageView sd_setImageWithURL:[NSURL URLWithString:_model.fProfilePhoto] placeholderImage:[UIImage imageNamed:@""]];
    /** 评论 */
    _commentLabel.text = _model.fComment;
    /** 评论 */
    _commentTimeLabel.text = _model.fCommentTime;
    
    [self setlayout];
    
}





@end
